//
//  SCUserModel.m
//  sooc-ios_new
//
//  Created by 郭琦 on 16/8/10.
//  Copyright © 2016年 SOOC. All rights reserved.
//

#import "SCUserModel.h"

@implementation SCUserModel
static SCUserModel *_instance;

+ (instancetype)sharedInstance_QiPei
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [[self alloc] init];
//        NSDictionary *dic = [[NSUserDefaults standardUserDefaults]objectForKey:@"user_message"];
//        _instance.uid = dic[@"uid"];
//        _instance.name = dic[@"name"];
//        _instance.RealName = dic[@"realname"];
//        _instance.email = dic[@"email"];
//        _instance.identityID = dic[@"identityid"];
//        _instance.identityType = dic[@"identitytype"];
//        _instance.img = dic[@"img"];
//        _instance.live_auth = dic[@"live_auth"] ;
       
    });
    return _instance;
}
+ (instancetype)sharedInstance_ShuangChuang
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [[self alloc] init];
        NSDictionary *dic = [[NSUserDefaults standardUserDefaults]objectForKey:@"user_message"];
        _instance.uid = dic[@"uid"];
        _instance.name = dic[@"name"];
        _instance.RealName = dic[@"realname"];
        _instance.email = dic[@"email"];
        _instance.identityID = dic[@"identityid"];
        _instance.identityType = dic[@"identitytype"];
        _instance.img = [NSURL URLWithString:dic[@"img"]];
        _instance.live_auth = dic[@"live_auth"];
        
    });
    return _instance;
}









-(void)setUid:(NSString *)uid{
    
    [self MessageWithKey:@"uid" andValue:uid];
}
-(NSString *)uid{
    
    return [self getObjectWithKey:@"uid"];
}


-(void)setName:(NSString *)name{
    
    [self MessageWithKey:@"name" andValue:name];
}
-(NSString *)name{
    
    return [self getObjectWithKey:@"name"];
}
-(void)setRealName:(NSString *)RealName{
    [self MessageWithKey:@"RealName" andValue:RealName];
}
-(NSString *)RealName{
     return [self getObjectWithKey:@"RealName"];
}
-(void)setXm:(NSString *)xm{
     [self MessageWithKey:@"xm" andValue:xm];
}
-(NSString *)xm{
      return [self getObjectWithKey:@"xm"];
}
-(void)setIdentityID:(NSString *)identityID{
    [self MessageWithKey:@"identityID" andValue:identityID];
}
-(NSString *)identityID{
      return [self getObjectWithKey:@"identityID"];
}
-(void)setSfzjh:(NSString *)sfzjh{
    [self MessageWithKey:@"sfzjh" andValue:sfzjh];
}
-(NSString*)sfzjh{
    return [self getObjectWithKey:@"sfzjh"];
}
-(void)setEmail:(NSString *)email{
     [self MessageWithKey:@"email" andValue:email];
}
-(NSString *)email{
    return [self getObjectWithKey:@"email"];
}
-(void)setIdentityType:(NSString *)identityType{
     [self MessageWithKey:@"identitytype" andValue:identityType];
}
-(NSString *)identityType{
    return [self getObjectWithKey:@"identitytype"];
}
-(void)setImg:(NSString *)img{
      [self MessageWithKey:@"img" andValue:img];
}
-(NSString *)img{
     return [self getObjectWithKey:@"img"];
}
-(void)setStudingCount:(NSString *)studingCount{
    [self MessageWithKey:@"studingCount" andValue:studingCount];
}
-(NSString *)studingCount{
    return [self getObjectWithKey:@"studingCount"];
}
-(void)setStudiedCount:(NSString *)studiedCount{
    [self MessageWithKey:@"studiedCount" andValue:studiedCount];
}
-(NSString *)studiedCount{
    return [self getObjectWithKey:@"studiedCount"];
}

-(void)setCellphone:(NSString *)cellphone{
     [self MessageWithKey:@"cellphone" andValue:cellphone];
}
-(NSString *)cellphone{
     return [self getObjectWithKey:@"cellphone"];
}
-(void)setLive_auth:(NSString *)live_auth{
    [self MessageWithKey:@"live_auth" andValue:live_auth?:@"0"];
}
-(NSString *)live_auth{
     return [self getObjectWithKey:@"live_auth"];
}









-(void)MessageWithKey:(NSString *)key andValue:(NSString *)value{
    NSDictionary *dic = [[NSUserDefaults standardUserDefaults]objectForKey:@"user_message"];
    NSMutableDictionary *para = [NSMutableDictionary dictionaryWithDictionary:dic];
    [para setValue:value forKey:key];
    
    [[NSUserDefaults standardUserDefaults]setObject:para forKey:@"user_message"];

    
   
    
    
}
-(NSString *)getObjectWithKey:(NSString *)key{
     NSDictionary *dic = [[NSUserDefaults standardUserDefaults]objectForKey:@"user_message"];
    return dic[key];
}

@end
